<?php
/**
 * common.php
 * Created by PhpStorm.
 * User: 江小波
 * Date: 2019/6/6
 * Time: 10:57
 */
if (!function_exists('get_url')) {
    /**
     * Url生成
     * @param string        $url 路由地址
     * @param bool|string   $domain 域名
     * @return string
     */
    function get_url($url = '', $domain = false)
    {
        if(isset($_SERVER['SERVER_NAME'])){
            $a = explode(".",$_SERVER['SERVER_NAME']);
            $b = array_pop($a);
            $c = array_pop($a);
            if($c === 'zgyqx' && $b === 'com'){
                return "/api".$url;
            }
        }
        return $url;
    }
}